<?php
/**
 * Created by PhpStorm.
 * User: edmmss
 * Date: 2019/1/29
 * Time: 09:29
 */

namespace app\modules\entityAttributeValue;


class Entity
{
    private $_values;

    private $_name;

    public function __construct(string $name, $values)
    {
        $this->_values = new \SplObjectStorage();
        $this->_name = $name;

        foreach ($values as $value) {
            $this->_values->attach($value);
        }
    }

    public function __toString()
    {
        // TODO: Implement __toString() method.
        $text = [$this->_name];

        foreach ($this->_values as $value) {
            $text[] = (string)$value;
        }

        return join(', ', $text);
    }
}